﻿<%@ Page Title="" Language="C#" MasterPageFile="~/NovaSystem.Master" AutoEventWireup="true" CodeBehind="wfFacturaVenta.aspx.cs" Inherits="NovaSystem.InterfazUsuarioWeb.Ventas.wfFacturaVenta" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table cellpadding="0" cellspacing="0" border="0" class="tabla" width="760px" align="center">
<tr>
<td>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <br />
    <table>
    <tr>
    <td>Nº Factura</td>
    <td><asp:TextBox runat="server" ID="txtNumeroFactura" Width="90px"></asp:TextBox>
        <asp:RequiredFieldValidator ID="rfvFactura" runat="server" 
            ControlToValidate="txtNumeroFactura" ErrorMessage="Ingrese Numero Factura" 
            ValidationGroup="Grabar">*</asp:RequiredFieldValidator>
        </td>
    <td></td>
    <td>
        <asp:HiddenField ID="hfSucursal" runat="server" />
        </td>
    <td></td>
    <td><asp:DropDownList runat="server" ID="ddlAfectaExcenta">
        <asp:ListItem Value="AFECTA">AFECTA</asp:ListItem>
        <asp:ListItem>EXENTA</asp:ListItem>
        </asp:DropDownList></td>
    <td></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td>Cliente</td>
    <td><asp:TextBox runat="server" ID="txtRutCliente" Width="89px"></asp:TextBox></td>
    <td><asp:ImageButton runat="server" ID="btnBuscarCliente" ImageUrl="~/img/Find.png" 
            onclick="btnBuscarProveedor_Click" /></td>
    <td>
        <asp:UpdatePanel ID="upCliente" runat="server" RenderMode="Inline">
            <ContentTemplate>
                <asp:TextBox runat="server" ID="txtNombreCliente" Width="193px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvProveedor" runat="server" 
                    ControlToValidate="txtNombreCliente" ErrorMessage="Ingrese Proveedor" 
                    ValidationGroup="Grabar">*</asp:RequiredFieldValidator>
                <asp:HiddenField ID="hfIdCliente" runat="server" />
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnBuscarCliente" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
        </td>
    <td>F. Factura</td>
    <td><asp:TextBox runat="server" ID="txtFechaFactura" Width="81px" 
            style="text-align:center"></asp:TextBox></td>
    <td><asp:ImageButton runat="server" ID="btnFechaFactura"  
            ImageUrl="~/img/Calendar.png" /></td>
    <td>O. Compra</td>
    <td><asp:TextBox runat="server" ID="txtOrdenCompra" Width="69px"></asp:TextBox></td>
    </tr>
    <tr>
    <td>Direccion</td>
    <td colspan="3">
        <asp:TextBox runat="server" ID="txtDireccionCliente" 
            Width="316px" ></asp:TextBox>
        <asp:RequiredFieldValidator ID="rfvDireccion" runat="server" 
            ControlToValidate="txtDireccionCliente" 
            ErrorMessage="Ingrese Direccion Proveedor" ValidationGroup="Grabar">*</asp:RequiredFieldValidator>
        </td>
    <td>País</td>
    <td colspan="4"><asp:DropDownList runat="server" id="ddlPais" 
            DataTextField="descripcion" DataValueField="codigo"></asp:DropDownList>
        <asp:RequiredFieldValidator ID="rfvPais" runat="server" 
            ControlToValidate="ddlPais" ErrorMessage="Ingrese Pais Proveedor" 
            ValidationGroup="Grabar">*</asp:RequiredFieldValidator>
        <cc1:CalendarExtender ID="ceFechaFactura" runat="server" FirstDayOfWeek="Monday" Format="dd/MM/yyyy" PopupButtonID="btnFechaFactura" TargetControlID="txtFechaFactura" PopupPosition="BottomLeft">
        </cc1:CalendarExtender>
        </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    
    </table>
</td>
</tr>
<tr>
<td background="../img/separador.png">
    <asp:TextBox ID="TextBox1" runat="server" Height="23px" Width="16px" 
        style="visibility:hidden"></asp:TextBox>
    </td>
</tr>
</table>

<table cellpadding="0" cellspacing="0" border="0" class="tabla" width="760px" align="center">
<tr>
<td background="../img/separadormenu.png" class="tituloTabla">Detalle
    <asp:TextBox ID="txtSeparadorDet" runat="server" Height="16px" Width="16px" 
        style="visibility:hidden"></asp:TextBox>
    </td>
</tr>
<tr>
<td>
        <table>
        <tr>
        <td colspan="2">Producto</td>
        <td>Descripción</td>
        <td>Cantidad</td>
        <td>Precio </td>
        <td>Total</td>
        
        </tr>
        <tr>
        <td><asp:TextBox runat="server" ID="txtProducto" Width="100px"></asp:TextBox>
            </td>
        <td><asp:ImageButton runat="server" ID="btnBuscarProducto" 
                ImageUrl="~/img/Find.png" onclick="btnBuscarProducto_Click" /></td>
        <td>
            <asp:UpdatePanel ID="upProducto" runat="server">
                <ContentTemplate>
                    <asp:TextBox runat="server" ID="txtDescripcion" Width="180px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvDescripcion" runat="server" 
                        ControlToValidate="txtDescripcion" ErrorMessage="Ingrese Descripción Producto" 
                        ValidationGroup="Agregar">*</asp:RequiredFieldValidator>
                    <asp:HiddenField ID="hfIdProducto" runat="server" />
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnBuscarProducto" EventName="Click" />
                </Triggers>
            </asp:UpdatePanel>
            </td>
        <td><asp:TextBox runat="server" ID="txtCantidad" Width="43px"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvCantidad" runat="server" 
                ControlToValidate="txtCantidad" ErrorMessage="Ingrese Cantidad" 
                ValidationGroup="Agregar">*</asp:RequiredFieldValidator>
            <asp:RangeValidator ID="rvCantidad" runat="server" 
                ControlToValidate="txtCantidad" ErrorMessage="Cantidad No valida" 
                MaximumValue="999999999" MinimumValue="1" Type="Integer" 
                ValidationGroup="Agregar">*</asp:RangeValidator>
            </td>
        <td><asp:TextBox runat="server" ID="txtPrecio" Width="55px" 
                CssClass="textBoxNumerico"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvPrecio" runat="server" 
                ControlToValidate="txtPrecio" ErrorMessage="Ingrese Precio" 
                ValidationGroup="Agregar">*</asp:RequiredFieldValidator>
            <asp:RangeValidator ID="rvPrecio" runat="server" ControlToValidate="txtPrecio" 
                ErrorMessage="Precio No valida" MaximumValue="999999999" 
                MinimumValue="0,000001" Type="Double" ValidationGroup="Agregar">*</asp:RangeValidator>
            </td>
        <td><asp:TextBox runat="server" ID="txtTotal" ReadOnly="true" Width="74px" 
                CssClass="textBoxNumerico"></asp:TextBox></td>
        <td><asp:Button runat="server" ID="btnAgregar" Text="Agregar" Width="58px" 
                onclick="btnAgregar_Click" ValidationGroup="Agregar" /></td>
        </tr>
        <tr>
            <td colspan="7">
       
               
               
                <asp:UpdatePanel ID="upDetalle" runat="server">
                    <ContentTemplate>
                     <div runat="server" id="divDetalleHeader">
                <table class="mGrid">
                <tr>
                <th>Producto</th>
                <th>Descripcion</th>
                <th>Cantidad</th>
                <th>Precio</th>
                <th>Unidad</th>
                <th>Total</th>
                <th>Precio Unit.</th>
                </tr>
                <tr>
                <td align="center" colspan="7">No existen registros en el detalle</td>
                </tr>
                </table>
                </div>
                    <table>
                    <tr>
                    <td colspan="3">
                        <asp:GridView runat="server" ID="gvDetalle" CssClass="mGrid" Width="738px" 
                          onrowcreated="gvDetalle_RowCreated">
                            <Columns>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:ImageButton ID="btnDelete" runat="server" ImageUrl="~/img/Delete.png" 
                                    OnCommand="OnDelete" CommandArgument="<%# Container.DataItemIndex %>" />
                                    </ItemTemplate>
                                    <ItemStyle Width="20px" />
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </td>
                    </tr>
                    <tr>
                    <td>Observaciones</td>
                    <td>Subtotal</td>
                    <td><asp:TextBox runat="server" ID="txtSubTotal" Width="93px" 
                            CssClass="textBoxNumerico" Enabled="False"></asp:TextBox></td>
                    </tr>
                    <tr>
                    <td rowspan="2">
                        <asp:TextBox runat="server" ID="txtObservacion" 
                            Width="491px" Height="46px" TextMode="MultiLine"></asp:TextBox></td>
                    <td>Impuesto</td>
                    <td><asp:TextBox runat="server" ID="txtIva" Width="93px" CssClass="textBoxNumerico" 
                            Enabled="False"></asp:TextBox></td>
                    </tr>
                    <tr>
                    <td>Descuento</td>
                    <td><asp:TextBox runat="server" ID="txtDescuento" Width="93px" 
                            CssClass="textBoxNumerico"></asp:TextBox></td>
                    </tr>
                    
                    <tr>
                    <td></td>
                    <td>Total</td>
                    <td><asp:TextBox runat="server" ID="txtTotalGeneral" Width="93px" 
                            CssClass="textBoxNumerico"></asp:TextBox></td>
                    </tr>
                    </table>
                        
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnAgregar" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>
     
            </td>
        </tr>
        
        <tr>
        <td colspan="10" align="center"><asp:Button runat="server" ID="btnGrabar" 
                Text="Grabar" onclick="btnGrabar_Click" ValidationGroup="Grabar" /> 
            &nbsp;&nbsp; 
            <asp:Button runat="server" ID="btnLimpiar" Text="Limpiar" 
                onclick="btnLimpiar_Click" />
        </td>
        </tr>
        </table>


</td>
</tr>
<tr>
<td background="../img/separador.png">
    <asp:TextBox ID="TextBox2" runat="server" Height="23px" Width="16px" 
        style="visibility:hidden"></asp:TextBox>
    </td>
</tr>
</table>

    <asp:UpdatePanel ID="upMsg" runat="server">
    <ContentTemplate>
        <asp:TextBox ID="txtGrabar" runat="server" Width="16px" style="visibility:hidden"></asp:TextBox>
    <asp:Button runat="server" ID="btnPopupMsg" style="visibility:hidden" />
    <cc1:ModalPopupExtender ID="mpeMensaje" runat="server" BackgroundCssClass="fondoDisabled" CancelControlID="btnAceptarMsg" DropShadow="true" PopupControlID="pnlMessage" TargetControlID="btnPopupMsg" >
    </cc1:ModalPopupExtender>
    
<asp:Panel runat="server" ID="pnlMessage" style="display:none">
<table class="tabla">
<tr>
<td colspan="2" class="fondoTitulo" align="center">Mensaje del Sistema</td>
</tr>
<tr>
<td style="padding-left:10px ; padding-right:10px"><asp:Image runat="server" 
        ID="imgMsg" ImageUrl="~/img/info.png" /></td>
<td style="padding-left:10px; padding-right:10px"><asp:Label runat="server" ID="lblMsg"></asp:Label></td>
</tr>
<tr>
<td colspan="2" align="center"><asp:Button runat="server" ID="btnAceptarMsg" Text="Aceptar" /></td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnGrabar" EventName="Click" />
        </Triggers>
</asp:UpdatePanel>
</asp:Content>
